home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /*
- * trackball.h
- * A virtual trackball implementation
- * Written by Gavin Bell for Silicon Graphics, November 1988.
- */
-
- #include "vect.h"
-
- /*
- * Pass the x and y coordinates of the last and current positions of
- * the mouse, scaled so they are from (-1.0 ... 1.0).
- *
- * if ox,oy is the window's center and sizex,sizey is its size, then
- * the proper transformation from screen coordinates (sc) to world
- * coordinates (wc) is:
- * wcx = (2.0 * (scx-ox)) / (float)sizex - 1.0
- * wcy = (2.0 * (scy-oy)) / (float)sizey - 1.0
- *
- * The resulting rotation is returned as a quaternion rotation in the
- * first paramater.
- */
- void
- trackball(float q[4], float p1x, float p1y, float p2x, float p2y);
-
- /*
- * Given two quaternions, add them together to get a third quaternion.
- * Adding quaternions to get a compound rotation is analagous to adding
- * translations to get a compound translation. When incrementally
- * adding rotations, the first argument here should be the new
- * rotation, the second and third the total rotation (which will be
- * over-written with the resulting new total rotation).
- */
- void
- add_quats(float *q1, float *q2, float *dest);
-
- /*
- * A useful function, builds a rotation matrix in Matrix based on
- * given quaternion.
- */
- void
- build_rotmatrix(float m[4][4], float q[4]);
-
- /*
- * This function computes a quaternion based on an axis (defined by
- * the given vector) and an angle about which to rotate. The angle is
- * expressed in radians. The result is put into the third argument.
- */
- void
- axis_to_quat(float a[3], float angle, float q[4]);
-
- /*
- * These are defined for compatibility with an older version of this
- * that referred to quaternions as 'Euler Paramaters'. The term
- * 'quaternion' is much more widely used in the computer graphics
- * community, and causes less confusion (Euler Paramaters are easily
- * confused with Euler Angles, which are totally different).
- */
- #define add_eulers add_quats
- #define axis_to_euler axis_to_quat
-